﻿using UnityEngine;
using System.Collections;

public class MotorImpulsor : Motor {

	public Rigidbody body;
	public float minStrength = 0.0f;
	public float maxStrength = 100.0f;
	
	public float probeInputFloat = 0;
	public float probeForceMagnitude = 0;

	public Vector3 anchor;
	
	
	void FixedUpdate () {
		
		float f = inputValue / 65534.0f;
		f = Mathf.Clamp01 (f);
		float m = minStrength + f * (maxStrength - minStrength);

		probeInputFloat = f;
		probeForceMagnitude = m;

		body.AddForceAtPosition (transform.forward * m, transform.TransformPoint(anchor), ForceMode.Impulse);
	
	}

}
